//
//  NOViewController.m
//  Y2NetWorking
//
//  Created by aloha-marbu on 11/11/2020.
//  Copyright (c) 2020 aloha-marbu. All rights reserved.
//

#import "NOViewController.h"
#import <Y2Networking.h>
#import <NSObject+Y2Mapping.h>
#import "Dog.h"

@interface NOViewController ()

@end

@implementation NOViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    
    NSDictionary *dic = @{ @"dogs": @[@{@"name": @"系哦啊花", @"gender": @"m"},
                                      @{@"name": @"系哦啊花", @"gender": @"m"}],
                           @"name": @"1",
                           @"hhs": @[@{}]
    };
    
    Person *d = [Person y2ObjectWithKeyValues:dic];

    NSLog(@"DD: name: %d, gender: %@", d.myName, d.myDogs);
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:touches withEvent:event];

    NSURL *URL = [NSURL URLWithString:@"http://106.52.2.240"];
    NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
    Y2HTTPSessionManager *manager = [[Y2HTTPSessionManager alloc] initWithBaseURL:URL sessionConfiguration:config];
    
    NSDictionary *parameters = @{
        @"q": @"TIZwTpsbDKHP8DwcHy%2FAwVpML%2BOW0RZL%2BiU9DFTpdmFfDzFncgAIrm86xzdoR88EfOrtqceNltvfUXK0M4%2BPCHYlCXQmoLbqb7L0wIrc0E%2B3m%2BeGGMFGKxI%2B7aaJYvAj%2BIuechMtwLOky9hDth1jxklVjFcTGnzzocxM%2BZQKOwUewTU7RAIuJEVc9hVvEgnOG%2BIZLb%2F9e%2FhYdBMfpeSSW2Kzy0jJvh2i%2FxiJc5RUHQsQs5thvgoBu7bWeo6UswFReXb02GueUkbYQiu9zxOm9YdrFZwdsfX1B6FfstiuyGwd6e%2BQCXEBEUTFYqWk8cTDZIjOkzcmZNflRqf%2Fu5RnKA%3D%3D",
        @"V": @"SUPER_ADMIN_APP_ID"
    };

    [manager GET:@"/opensdk-router/open/sdk/init" parameters:nil headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSLog(@"111");
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"222");
    }];
}

@end
